
-- procedure to remove a user
-- returns 1 if can remove, 0 cannot modify
IF OBJECT_ID('removeUser') IS NOT NULL
BEGIN
	DROP PROCEDURE removeUser;
END
GO
CREATE PROCEDURE removeUser
	@UserId			INT
AS
BEGIN
	IF EXISTS(SELECT * FROM users WHERE userid=@UserId)
		BEGIN
			UPDATE users SET isdeleted=1 WHERE userid=@UserId;
			SELECT 1;
		END
	ELSE
		BEGIN
			SELECT 0;
		END
END
GO